﻿#ifndef COMMON_H
#define COMMON_H

#include "bezier/bezier.h"

#include <QObject>
#include <QGraphicsView>
#include <QPixmap>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <QPointF>
#include <QWheelEvent>
#include <QScrollBar>
#include "publicshare.h"
#include "Logger/tmlogger.h"

extern TmLogger *g_TmLogger;

static const QString g_RobotPose = "/tracked_pose";//机器人点位
static const QString g_RobotScan_multi = "/scan_multi2";//激光雷达数据
//static const QString g_RobotScan_multi = "/scan_matched_points2";//激光雷达数据
static const QString g_RobotBattery_state = "/battery_state";//电池信息
static const QString g_RobotCmd_vel = "/mycar/cmd_vel";//手动控制
static const QString g_RobotEquipmentStatu = "/EquipmentStatu";//设备状态 驱动轮 超声波
static const QString g_RobotCreateMap = "/map";//建图数据
static const QString g_RobotNavi_status = "/navigation_status";//路线点位信息
static const QString g_RobotLocalization = "/start_localization";//开始重定位地图
static const QString g_RobotRequest_service = "/tami_pnc/map_request_service";//导航执行执行状态反馈
static const QString g_RobotHandLocalization = "/initialpose_ori";//手动定位
static const QString g_Robot_linearOrang_speed = "/wheel_odom";//机器人线速度和角速度
static const QString g_Robot_localization_accuracy = "/localization_accuracy";//定位精度


static const int ItemId = 1;   //key:ID
static const int ItemDesciption = 2;   //key:描述
static const int ItemLineStartItem = 3;   //line key:线路开始点Item的ID
static const int ItemLineEndItem = 4;   //line key:线路结束点Item的ID
static const int ItemBezierLineID = 5;   //line key:bezier点关联的路线ID
static const int ItemBezierPointID = 6;   //line key:bezier点关联的点位ID 路线起始点A->B
static const int ItemStraightLine = 7;   //line key:bezier点关联的路线是否是直线

static const QString ItemDesciption_Point = "point";
static const QString ItemDesciption_Line = "line";
static const QString ItemBezier_Strat = "BezierStrat";
static const QString ItemBezier_End = "BezierEnd";
static const QString ItemBezier_Direct = "BezierDirect";

static const QString LineMessSplit = "~~";

extern int g_RobotChassisLength;   //机器人底盘长度 单位CM
extern int g_RobotChassisWidth;   //机器人底盘宽度 单位CM
extern int g_RobotChassisRadius;   //机器人底盘半径
extern QString g_strExeRoot;
extern QString g_CurrentMapID;//当前打开的地图名名称
extern QString g_LocalMapPath;//本地地图路径 "E:/maps"
extern QString g_RemoteMapPath;//远程地图路径 "/home/.tami/maps"

extern QString g_map_Image;//#当前地图的文件名 xxx.pgm
extern double  g_map_resolution;//#地图分辨率 单位：米/像素
extern double  g_map_origin[3];//图像左下角在地图坐标下的坐标

extern bool  g_is_OpenMapEdit;//是否打开地图编辑
extern bool  g_is_OpenCreateMap;//是否开始创建地图

extern qreal  g_curScaleValue;//当前缩放比例
extern QStringList  g_StationPointList;//当前导航路线经过的点位
extern QStringList  g_StationOFFPointList;//当前导航路线已经经过的点位
extern QString g_CurrentStationPoint;//当前导航的目的点位

struct Map_Point_Mess{
public:
    // double x;
    // double y;
    // double z;
    // QString ID;
    QGraphicsRectItem   *item;
};

enum CurrentActionType{
    Action_NULL = 0,
    Action_DrawLine,//绘制路线
    Action_VirtualWall,//虚拟墙
    Action_Eraser,//橡皮擦
    Action_AddPoint,//添加点位
    Action_mapLocation//重定位
};

struct Map_Line_Mess{
public:
    int Door;
    QString Data;
};

#endif // COMMON_H
